/***********************************************************************************
 @file   
 @author
 @attention
 ***********************************************************************************/
#ifndef __CRC_H
#define __CRC_H
#include "main.h"
/****CRC校验值表****/

#define CRC16_POLY        0x8005
#define CRC16_INIT_REM    0x0000
#define CRC16_FINAL_XOR   0x0000
#define CRC_TABLE_SIZE    256
#define CRC_16_POLYNOMIALS          0x8005

extern const unsigned char chCRCHTalbe[];				// CRC 高位字节值表
extern const unsigned char chCRCLTalbe[];				// CRC 低位字节值表

uint16_t  GetCRC(uint8_t CRCArray[],uint16_t ArrayLen);

uint16_t  CRC16_TCP(uint8_t *pchMsg, uint16_t  wDataLen);
uint8_t   checkCRC(uint8_t CRCArray[],uint16_t ArrayLen);
uint8_t   crc_16_CCITT_False(uint8_t * pucFrame,uint8_t offset ,uint8_t usLen);
uint16_t  CRC16_IBM(uint8_t* p_crc_data, uint16_t crc_long);
//unsigned short CRC16(unsigned char *puchMsg, unsigned short usDataLen);
unsigned short CRC16_XMODEM(unsigned char *puchMsg, unsigned int usDataLen);
unsigned short crc16MakeTableMethod(unsigned char *pbuffer, unsigned int length);
#endif
